package com.zqh.productcommentcud.controller;

import com.zqh.myfmmall.entity.ProductComments;
import com.zqh.myfmmall.result.Result;
import com.zqh.productcommentcud.service.ProductCommentCUDService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description :
 * @Author :kono淇杭哒、
 * @Create 2022-02-18 2:15
 */
@RestController
@RequestMapping("productComment")
public class ProductCommentCUDController{
    @Autowired
    private ProductCommentCUDService productCommentCUDService;


    @PostMapping("create")
    public Result add(@RequestBody ProductComments productComments){
        return productCommentCUDService.save(productComments) ? Result.success() : Result.internalServerError();
    }

    @PutMapping("update")
    public Result update(@RequestBody ProductComments productComments){
        return productCommentCUDService.updateById(productComments) ? Result.success() : Result.internalServerError();
    }


    @DeleteMapping("delete/{id}")
    public Result delete(@PathVariable("id") String id){
        return productCommentCUDService.removeById(id) ? Result.success() : Result.internalServerError();
    }


}
